package com.jic.product.impl;

import java.lang.Long;
import java.util.ArrayList;
import java.util.List;

import com.jic.product.entity.CategoryTreeNodeRelation;
import com.jic.product.manage.response.CategoryTreeNodeRelationResponse;
import com.jic.product.mapper.CategoryTreeNodeRelationMapper;
import com.jic.product.service.CategoryTreeNodeRelationService;
import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 类目节点聚合表
 * @author : 
 * @email : 
 * @since : 2020-01-10 07:03:01
 * @version : v1.0.0
 */
@Service
public class CategoryTreeNodeRelationServiceImpl implements CategoryTreeNodeRelationService{

    @Autowired
    private CategoryTreeNodeRelationMapper categoryTreeNodeRelationMapper;

    @Override
    public List<CategoryTreeNodeRelationResponse> insert(CategoryTreeNodeRelation categoryTreeNodeRelation) {
         categoryTreeNodeRelation.setType(2);//默认部分聚合
         categoryTreeNodeRelationMapper.insert(categoryTreeNodeRelation);
          //根据前台类目ID查询当前前台类目已聚合
          List<CategoryTreeNodeRelationResponse> categoryTreeNodeRelationResponseList=categoryTreeNodeRelationMapper.queryByLeftTreeNodeId(categoryTreeNodeRelation.getLeftTreeNodeId());
          return categoryTreeNodeRelationResponseList;
    }

    @Override
    public long delete(Long id) {
        return categoryTreeNodeRelationMapper.delete(id);
    }

    @Override
    public long update(CategoryTreeNodeRelation categoryTreeNodeRelation) {
        return categoryTreeNodeRelationMapper.update(categoryTreeNodeRelation);
    }

    @Override
    public CategoryTreeNodeRelation queryByPrimaryKey(Long id){
        return categoryTreeNodeRelationMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<CategoryTreeNodeRelationResponse> query(CategoryTreeNodeRelation categoryTreeNodeRelation){
        return categoryTreeNodeRelationMapper.query(categoryTreeNodeRelation);
    }


}